package com.ajie.bluetoothcard.db;
/**
 * 数据库表的列名称
 * @author BigMao
 *
 */
public class Column {
	private String name;
	private Type type;
	private boolean nullable = true;
	private boolean primaryKey = false;

	
	public static final String Card_ID="_id";
	public static final String Card_name="name";
	/** 手机号码 */
	public static final String Card_mobilePhone="mobilePhone";
	/** 电话号码 */
	public static final String Card_telephone="telephone";
	/** 类型 */
	public static final String Card_type="type";
	/** 是否被删除 */
	public static final String Card_isDel="isDel";
	/** 头像地址 */
	public static final String Card_avatar="avatar";
	/** 职务 */
	public static final String Card_title="title";
	/** 单位 */
	public static final String Card_company="company";
	/** 语音 */
	public static final String Card_voide="voide";
	/** 地址 */
	public static final String Card_address="address";
	/** 简介 */
	public static final String Card_introduction="introduction";
	/** 创建时间 */
	public static final String Card_time="time";
	/** URL */
	public static final String Card_url="url";
	/** Email */
	public static final String Card_email="email";
	/** 传真 */
	public static final String Card_fax="fax";
	
	/** 分类名字 */
	public static final String Card_Type_name="name";
	/** 这组下几个 */
	public static final String Card_Type_number="number";
	/** 分类ID对应Card表中的type */
	public static final String Card_Type_ID="type";

	public Column(String name, Type type){
		this.name = name;
		this.type = type;
	}
	
	public String getCreateString(){
		String createText = name +" " + type.typeStrng;
		if(!nullable){
			createText += " not null";
		}
		
		if(primaryKey){
			createText += " primary key";
		}
		return createText;
	}
	
	
	public String getName(){
		return name;
	}
	
	public Column setNullable(boolean nullable){
		this.nullable = nullable;
		return this;
	}
	
	public Column setPrimaryKey(boolean primaryKey){
		this.primaryKey = primaryKey;
		return this;
	}
	
	public enum Type{
		INTEGER("integer"),STRING("text"),FLOAT("real"),;
		private String typeStrng;
		 
		Type(String typeString){
			this.typeStrng = typeString;
		}
	}

}
